home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / shareware / music / edplayer_2.1 / cteled.c < prev    next >
C/C++ Source or Header  |  1994-11-17  |  3KB  |  91 lines

  1. /* C version of TellEd, version 2.1, by Ed Mackey */
  2.  
  3. /* This is a program demonstrating how to call EdPlayer withOUT the
  4.    use of ARexx.  Do NOT use this method on ANY other program besides
  5.    EdPlayer.  For information on creating true AREXX messages, please
  6.    see your ARexx manual.                                              */
  7.  
  8. /* This is for the Aztec Manx C compiler */
  9. /* and is dedicated to all those MegaBall fans
  10.    who gave me the money to buy it...    */
  11.  
  12. #include <functions.h>
  13. #include <exec/types.h>
  14. #include <exec/ports.h>
  15. #include "edplayer.h"
  16.  
  17. main(argc,argv)
  18. int argc;      
  19. UBYTE *argv[];
  20. {
  21.   long mypri,lp,retval;    /* Init some variables */
  22.   char *daa;
  23.   char *dbb;
  24.  
  25.   struct MsgPort *myport, *mynewport;
  26.   struct Message *mymsg;
  27.   struct EdMessage sndmsg, *EdPmsg;
  28.  
  29.   retval = 21;    /* Error if something goes wrong */
  30.  
  31.   if (argc != 2) {
  32.     printf("Usage: %s \"<Edplayer command>\"\n",argv[0]);
  33.   } else {
  34.     sndmsg.result = 0l;  /* Always init results to 0 */
  35.     sndmsg.result2 = 0l;
  36.  
  37.     (char *)sndmsg.EdCommand = (char *)argv[1];  /* load up command */
  38.     printf("Telling EdPlayer to %s.\n",argv[1]);
  39.  
  40.     mypri = 0;
  41.     mynewport = CreatePort(NULL,mypri);  /* Make a replyport */
  42.     sndmsg.MainMess.mn_Length = 44;
  43.     sndmsg.MainMess.mn_ReplyPort = (struct MsgPort *)mynewport;
  44.  
  45.     Forbid();  /* MULTITASKING = OFF, so EdP doesn't trick us */
  46.     myport = FindPort((char *)"EDPLAYER");
  47.  
  48.     if (myport == NULL) {
  49.  
  50.       Permit(); /* MULTITASKING = ON */
  51.       printf("Could not find EdPlayer in system.  Please run it.\n");
  52.  
  53.     } else {
  54.  
  55.       PutMsg(myport,(struct Message *)&sndmsg);  /* SEND THE MSG! */
  56.       Permit(); /* MULTITASKING = ON */
  57.  
  58.       mymsg = WaitPort(mynewport);   /* Wait for it..... */
  59.       mymsg = GetMsg(mynewport);    /* Get the returned message */
  60.  
  61.       EdPmsg = (struct EdMessage *)mymsg;
  62.       retval = EdPmsg->result;
  63.       printf("Returned %d: ",retval);   /* Tell user the number */
  64.  
  65.       switch (retval) {       /* Tell user what the # means... */
  66.         case  0 : printf("All OK.\n"); break;
  67.         case  3 : printf("There is no main panel in EdPlayer Junior.\n"); break;
  68.         case  4 : printf("Can't give result.  Use ARexx (AskEd) not cteled.\n"); break;
  69.         case  5 : printf("Incorrect password for PP-encrypted file.\n"); break;
  70.         case  6 : printf("No program.\n"); break;
  71.         case  7 : printf("Illegal JUMP.\n"); break;
  72.         case  8 : printf("Music STOPped, can't continue.\n"); break;
  73.         case  9 : printf("Nothing to PLAY!\n"); break;
  74.         case 10 : printf("Syntax error.\n"); break;
  75.         case 11 : printf("Can't allocate serial port for MIDI.\n"); break;
  76.         case 12 : printf("File not found.\n"); break;
  77.         case 13 : printf("Can't find LIBS:powerpacker.library.\n"); break;
  78.         case 14 : printf("Disk error.\n"); break;
  79.         case 15 : printf("Out of CHIP memory.\n"); break;
  80.         case 16 : printf("Unknown module type, or corrupted module!\n"); break;
  81.         case 17 : printf("Can't find LIBS:rexxsyslib.library.\n"); break;
  82.         case 21 : printf("EdPlayer is exiting, command ignored.\n"); break;
  83.         default : printf("Unknown error!  Please upgrade to a newer version of cteled.\n");
  84.       };
  85.  
  86.       DeletePort(mynewport);   /* Kill the replyport */
  87.     }
  88.   }
  89.   exit(retval);  /* Tell AmigaDOS all about it, too */
  90. }
  91.